{% extends "../theme/base_edit.html" %}

{% block edit %}

<div class="panel panel-black">
    <div class="panel-heading">修改地图 - {{ postinfo.title }}</div>

    <div class="panel-body">
        <form action="/map/edit/{{ postinfo.uid }}" method="post" class="form-horizontal" id="form_post" role="form">

            <fieldset>

                <input type="hidden" id="uid" name="uid" value="{{ postinfo.uid }}"/>


                <div class="form-group">
                    <label for="title" class="col-sm-2 control-label">标题</label>

                    <div class="col-sm-10">
                        <input type="text" id="title" name="title" value="{{ postinfo.title }}" class="form-control">
                    </div>
                </div>

               <div class="form-group">
                    <label for="stitle" class="col-sm-2 control-label">Short Title</label>
                    <div class="col-sm-10">
                        <input type="text" id="ext_stitle" name="ext_stitle" class="form-control" value="{{postinfo.extinfo['ext_stitle'] if 'ext_stitle' in postinfo.extinfo else postinfo.title}}">
                    </div>
                </div>



                <div class="form-group">
                    <label for="keywords" class="col-sm-2 control-label">关键词</label>

                    <div class="col-sm-10">
                        <input type="text" id="keywords" name="keywords" value="{{ postinfo.keywords }}"
                               class="form-control">
                    </div>
                </div>



                <div class="form-group">
                    <label for="tags" class="col-sm-2 control-label">标签</label>
                    <div class="col-sm-10">
                        <input type="text" id="tags" name="tags" class="form-control" value="{% for x in app2label_info %}
                {{ x.tag_name}},
                {% end  %}">
                    </div>
                </div>

                <div class="form-group">
                    <label for="ext_lat" class="col-sm-2 control-label">lat</label>

                    <div class="col-sm-10">
                        <input type="text" id="ext_lat" name="ext_lat" class="form-control" value="{{postinfo.extinfo['ext_lat']}}">
                    </div>
                </div>


                <div class="form-group">
                    <label for="ext_lon" class="col-sm-2 control-label">lon</label>

                    <div class="col-sm-10">
                        <input type="text" id="ext_lon" name="ext_lon" class="form-control" value="{{postinfo.extinfo['ext_lon']}}">
                    </div>
                </div>

                <div class="form-group">
                    <label for="ext_zoom_max" class="col-sm-2 control-label">zoom_max</label>

                    <div class="col-sm-10">
                        <input type="text" id="ext_zoom_max" name="ext_zoom_max" class="form-control"
                               value="{{postinfo.extinfo['ext_zoom_max'] }}">
                    </div>
                </div>


                <div class="form-group">
                    <label for="ext_zoom_min" class="col-sm-2 control-label">zoom_min</label>

                    <div class="col-sm-10">
                        <input type="text" id="ext_zoom_min" name="ext_zoom_min" class="form-control"
                               value="{{postinfo.extinfo['ext_zoom_min']}}">
                    </div>
                </div>


                <div class="form-group">
                    <label for="ext_zoom_current" class="col-sm-2 control-label">zoom_current</label>

                    <div class="col-sm-10">
                        <input type="text" id="ext_zoom_current" name="ext_zoom_current" class="form-control"
                               value="{{postinfo.extinfo['ext_zoom_current'] }}">
                    </div>
                </div>


                {% for ii in range(0,5) %}
                <div class="form-group">
                    {% if ii == 0 %}
                    <label for="pcat0" class="col-sm-2 control-label">分类</label>
                    {% else %}
                    <label class="col-sm-2 control-label"></label>
                    {% end %}
                    <div class="col-sm-3">
                        <select name="pcat{{ii}}" id="pcat{{ii}}" class="form-control" onchange="g_load_infocat({{ii}})">
                            <option value="">请选择</option>
                            {% for taginfo in tag_infos %}
                            {% if taginfo.uid.endswith('00') %}
                            <option value="{{ taginfo.uid }}"
                                    {% for tt in app2tag_info %}
                                    {% if tt.order== ii and tt.tag_id.startswith(taginfo.uid[:2]) %}
                                    selected
                                    {% end %}
                                    {% end %} >{{ taginfo.name }}
                            </option>
                            {% else %}

                            {% end %}
                            {% end %}
                        </select>
                    </div>

                    <div class="col-sm-4">
                        <select name="gcat{{ii}}" id="gcat{{ii}}" class="form-control" >
                            <option value="">请选择</option>
                            {# 设置父类ID，用在下面子类是否显示看 #}
                            {% set pcatid = 'xx' %}
                            {% for taginfo in tag_infos %}
                                {% for tt in app2tag_info %}
                                    {% if tt.order== ii and tt.tag_id == taginfo.uid %}
                                        {% set pcatid = tt.tag_id[:2] %}
                                    {% end %}
                                {% end %}
                            {% end %}



                            {% for taginfo in tag_infos2 %}
                            {% if taginfo.uid.startswith(pcatid) %}
                            {% if not taginfo.uid.endswith('00') %}
                            <option value="{{ taginfo.uid }}"
                                    {% for tt in app2tag_info %}
                                    {% if tt.order== ii and tt.tag_id== taginfo.uid %}
                                    selected
                                    {% end %}
                                    {% end %}  >{{ taginfo.name }}
                            </option>
                            {% else %}
                            {% end %}
                            {% end %}
                            {% end %}

                        </select>
                    </div>

                </div>
                {% end %}


                <div class="form-group">
                    <label class="col-sm-2 control-label" for="valid">是否可用</label>
                    <div class="col-sm-10">
                        <select name="valid" id="valid" class="form-control">
                            <option value="1">是</option>
                            <option value="0">否</option>
                        </select>
                    </div>
                </div>

                                <div class="form-group">
                    <label for="keywords" class="col-sm-2 control-label">Logo</label>

                    <div class="col-sm-10">
                        <input type="text" id="logo" name="logo" value="{{ postinfo.logo }}" class="form-control">
                    </div>
                </div>


                <div class="form-group">


                    <label for="up" class="col-sm-2 control-label">上传图片</label>

                    <div class="col-sm-10">
                    <span id="up"><a href="/entry/add" target="_blank"
                                     class="btn btn-primary">上传</a></span>
                    </div>

                </div>

                <div class="form-group">
                    <label for="cnt_md" class="col-sm-2 control-label">内容</label>

                    <div class="col-sm-10">
                        <textarea rows=16 id="cnt_md" name="cnt_md" cols="70" class="form-control">{% raw unescape(postinfo.cnt_md) %}</textarea>
                    </div>
                </div>


                <div class="form-group">
                    <label for="sub1" class="col-sm-2 control-label"></label>

                    <div class="col-sm-10">
                        <input id="sub1" type="submit" value="更新数据" class="btn btn-primary">
                    </div>
                </div>
            </fieldset>
        </form>
    </div>
</div>


{% end %}


